/*
 * TicketTest.java
 *
 * This program demonstrates using a class to accept and display information
 * about an airline ticket.
 *
 
 */

package com.javacore.day3.booking;

import java.util.Scanner;

/**
 * TicketTest is a class to accept and display the information about
 * an airline ticket.
 * @author
 */

public class TicketTest {
    
    /** Creates a new instance of TicketTest */
    public TicketTest() {
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        // Create an instance of FlightTicket class
        FlightTicket ticket = new FlightTicket();
        
        Scanner input = new Scanner(System.in);
        
        // Accept date of departure
        System.out.println("Enter departure date (mm dd yyyy): ");
        byte day = input.nextByte();
        byte month = input.nextByte();
        short year = input.nextShort();
        
        // Set the departure date by passing primitive values to a method
        ticket.setDepartureDate(day, month, year);
        
        // Create an instance of Time class and store departure time in it
        Time timeOfDeparture = new Time();
        
        System.out.println("Enter departure time (hh mm): ");
        timeOfDeparture.hours = input.nextByte();
        timeOfDeparture.minutes = input.nextByte();
        
        // Set the departure time by passing an object to a method
        ticket.setDepartureTime(timeOfDeparture);
        
        // Accept and set the type of cabin
        System.out.println("Enter the type of cabin: \n1. Business\n2. First\n3. Economy\n");
        ticket.typeOfCabin = input.nextByte();
        
        // Accept and set the number of tickets
        System.out.println("Enter the number of tickets: ");
        ticket.noOfTickets = input.nextByte();
        
        // Display the ticket information
        ticket.displayTicketInformation();
    }
    
}
